<template>
	<view>
		<navbar title="我的余额" :autoBack="true" bg="#fff"></navbar>
		<view class="con">
			<view class="box">
				<view class="con__top">
					<image src="/static/person/qianbaotop.png" class="con__top__bg" mode=""></image>
					<view class="con__top__box">
						<view class="con__top__box__title">
							帐户余额
						</view>
						<view class="con__top__box__num">
							{{info.money}}
						</view>
						<view class="u-flex u-flex-xy-center">
							<view class="con__top__box__i">
								<view class="con__top__box__i__text">
									分成收益
								</view>
								<view class="con__top__box__i__num">
									{{info.alldivide}}
								</view>
							</view>
							<view class="con__top__box__line">
								
							</view>
							<view class="con__top__box__i">
								<view class="con__top__box__i__text">
									本月分成
								</view>
								<view class="con__top__box__i__num">
									{{info.monthdivide}}
								</view>
							</view>
							<view class="con__top__box__line">
								
							</view>
							<view class="con__top__box__i">
								<view class="con__top__box__i__text">
									本日分成
								</view>
								<view class="con__top__box__i__num">
									{{info.divide}}
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class="con__title">
					<view class="con__title__b">
						
					</view>
					<view class="con__title__t">
						账务明细
					</view>
					<view class="con__title__btn" @click="clicktx">
						<image src="/static/person/xf.png" class="con__title__btn__icon" mode=""></image>
						提现
					</view>
				</view>
			</view>
			<scroll-view scroll-y="true" class="scbox" @scrolltolower="scrolltolower">
				<view class="con__list">
					<view class="con__list__item" v-for="(item,index) in list" :key="index">
						<view class="">
							<view class="con__list__item__name">
								{{item.memo}}
							</view>
							<view class="con__list__item__time">
								{{$u.timeFormat(item.createtime, 'yyyy-mm-dd hh:MM:ss')}}
								<!-- 2023-5-23 08:25 -->
							</view>
						</view>
						<view class="u-flex u-flex-y-center con__list__item__num" v-if="item.type==1">
							+
							{{item.money}}
						</view>
						<view class="u-flex u-flex-y-center con__list__item__num" v-if="item.type==2">
							-
							{{item.money}}
						</view>
					</view>
					<u-loadmore :status="status" fontSize='24rpx' color='#313131' :nomore-text="nomoreText" marginTop='50rpx' marginBottom='50rpx' />
					<view class="" style="height: 2rpx;">
						
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import user from '@/api/_user.js'
	export default {
		data() {
			return {
				status: 'nomore',
				nomoreText:'~没有更多了~',
				info:{},
				list:[]
			};
		},
		methods:{
			scrolltolower(){
				if (this.page >= 3) return;
				this.status = 'loading';
				this.page = ++this.page;
				setTimeout(() => {
					this.list += 10;
					if (this.page >= 3) this.status = 'nomore';
					else this.status = 'loading';
				}, 2000)
			},
			clicktx(){
				user.myValid().then(res => {
					if (res.data.code == 1) {
						if (!res.data.msg) {
							uni.$u.toast('请先进行提款认证')
							setTimeout(()=>{
								uni.navigateTo({
									url:'/pages/personal/authentication'
								})
							},1000)
						}else if(res.data.msg.status==1){
							uni.$u.toast('提款认证正在审核')
							
						}else{
							this.navto('/pages/personal/withdrawal')
						}
					}
				})
				
			}
		},
		onLoad() {
			user.myWallet().then(res=>{
				if(res.data.code==1){
					this.info=res.data.data
					this.list=res.data.data.log
				}
			})
		}
	}
</script>

<style lang="scss">
	.scbox{
		height: calc(100vh - var(--status-bar-height) - 44px - 340rpx - 40rpx - 35rpx - 66rpx);
	}
.con{
	padding: 20rpx 0 0;
	.box{
		padding: 0 30rpx;
	}
	&__top{
		width: 690rpx;
		height: 340rpx;
		position: relative;
		&__bg{
			width: 690rpx;
			height: 340rpx;
			position: absolute;
			top: 0;
			left: 0;
			
		}
		&__box{
			padding: 63rpx 0 0;
			position: relative;
			&__title{
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: #010101;
				line-height: 28rpx;
				margin: 0 0 33rpx 50rpx;
			}
			&__num{
				font-family: DIN Next LT Pro;
				font-weight: 400;
				font-size: 72rpx;
				color: #010101;
				line-height: 53rpx;
				margin-left: 50rpx;
				margin-bottom: 60rpx;
			}
			&__line{
				width: 2rpx;
				height: 30rpx;
				background: #839EC5;
				opacity: 0.5;
			}
			&__i{
				width: 33.33%;
				display: flex;
				flex-direction: column;
				align-items: center;
				&__text{
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #3A4E6D;
					line-height: 24rpx;
					margin-bottom: 25rpx;
				}
				&__num{
					font-family: DIN Next LT Pro;
					font-weight: 500;
					font-size: 32rpx;
					color: #010101;
					line-height: 24rpx;
				}
			}
		}
	}
	&__title{
		display: flex;
		align-items: center;
		padding: 0 0 0 12rpx;
		position: relative;
		justify-content: space-between;
		margin-top: 35rpx;
		&__b{
			width: 29rpx;
			height: 29rpx;
			background: linear-gradient(-35deg, #BFCDE1 0%, #FFFFFF 100%);
			border-radius: 50%;
			position: absolute;
			top: -12rpx;
			left: 0;
		}
		&__t{
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 30rpx;
			color: #010101;
			line-height: 30rpx;
			position: relative;
		}
		&__btn{
			width: 136rpx;
			height: 66rpx;
			border-radius: 33rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 24rpx;
			background-color: #bfcde0;
			color: #3A4E6D;
			line-height: 24rpx;
			&__icon{
				width: 30rpx;
				height: 30rpx;
				margin-right: 9rpx;
				margin-top: 2px;
			}
		}
	}
	&__list{
		padding-left: 14rpx;
		&__item{
			padding: 44rpx 30rpx 40rpx 19rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 2rpx solid #f4f5f6;
			&__name{
				font-family: PingFang SC;
				font-weight: 800;
				font-size: 26rpx;
				color: #333333;
				line-height: 25rpx;
				margin-bottom: 22rpx;
			}
			&__time{
				font-family: PingFang SC;
				font-weight: 300;
				font-size: 24rpx;
				color: #3A4E6D;
				line-height: 19rpx;
			}
			&__num{
				font-family: DIN Next LT Pro;
				font-weight: 500;
				font-size: 33rpx;
				color: #333333;
				line-height: 33rpx;
			}
			&__jia{
				width: 14rpx;
				height: 14rpx;
				margin-right: 8rpx;
				margin-bottom: 2px;
			}
		}
	}
}
</style>
